﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Input;
using BluSteamClient.Model;

namespace BluSteamClient.ViewModel
{
    public class SampleViewModel : INotifyPropertyChanged
    {
        #region Fields

        public event PropertyChangedEventHandler PropertyChanged;
        private RelayCommand _calculateSquareRootCommand;
        private double _result;
       // private readonly SampleModel _model;

        #endregion

        #region Constructors

        public SampleViewModel()
        {
            //_model = new SampleModel();
        }

        #endregion

        #region Properties

        public double Result
        {
            get { return _result; }
            private set
            {
                if (_result != value)
                {
                    _result = value;
                    OnPropertyChanged("Result");
                }
            }
        }

        public double Number
        {
            get;
            set;
        }

        public ICommand CalculateSquareRootCommand
        {
            get
            {
                if (_calculateSquareRootCommand == null)
                {
                    _calculateSquareRootCommand = new RelayCommand(ParamArrayAttribute => this.CalculateSquareRoot());
                }
                return _calculateSquareRootCommand;
            }
        }

        #endregion

        #region Methods

        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void CalculateSquareRoot()
        {
            //Result = _model.CalculateSquareRoot(Number);
        }

        #endregion
    }
}
